package com.tuanzi.loan.core.util;

import org.apache.commons.lang3.StringUtils;

/**
 * @author Ray 2017/11/01
 */
public class DesensitizationUtils {

	public static final String desensitize(String str) {
		if (StringUtils.isBlank(str)) {
			return StringUtils.EMPTY;
		}

		if (StringUtils.length(str) >= 4) {
			return str.substring(0, str.length() - 4) + "****";
		} else {
			return str.substring(0, str.length() - 1) + "*";
		}
	}

}
